<template>
	<view class="container">
		<view class="tui-page__hd">
			<view class="tui-page__title">slide-view</view>
			<view class="tui-page__desc">左滑操作，wxs实现</view>
		</view>
		<view class="tui-page__bd">
			<tui-slide-view :buttons="buttons"  @click="handleClick">
				<view class="tui-list-cell">
					<text>左滑菜单（text）</text>
				</view>
			</tui-slide-view>
			
			<view class="tui-img__menu">
				<tui-slide-view :buttons="buttons" :show="true" @click="handleClick">
					<view class="tui-list-cell">
						<text>左滑菜单（text）</text>
					</view>
				</tui-slide-view> 
			</view>
			
			<view class="tui-img__menu tui-padding" >
				<tui-slide-view :buttons="buttonArr" width="100rpx" height="100rpx" radius="100rpx" padding="0">
					<view class="tui-list-cell tui-image__cell">
						<text>左滑菜单（image）</text>
					</view>
				</tui-slide-view>
			</view>
		
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				buttons: [{
					text: '标为未读',
					color: '#fff',
					background: '#4C4C4C',
					//额外参数，根据需要传入
					data:{id:1,custom:2020}
				}, {
					text: '不显示',
					color: '#fff',
					background: '#FA9D3B'
				}, {
					text: '删除',
					color: '#fff',
					background: '#FA5151'
				}],
				buttonArr: [{
					src: '/static/images/extend/icon_edit_3x.png',
					width: '48rpx',
					height: '48rpx',
					background: '#fff'
				}, {
					src: '/static/images/extend/icon_delete_3x.png',
					width: '48rpx',
					height: '48rpx',
					background: '#fff'
				}]
			};
		},
		methods: {
			handleClick(e){
				console.log(e)
				let index=Number(e.index)
				this.tui.toast(`你点击了：${this.buttons[index].text}`)
			}
		}
	};
</script>

<style>
	.tui-list-cell {
		width: 100%;
		height: 120rpx;
		padding: 0 30rpx;
		box-sizing: border-box;
		background-color: #fff;
		display: flex;
		align-items: center;
	}
	.tui-image__cell{
		height: 120rpx;
		border-radius: 16rpx;
		overflow: hidden;
	}
	.tui-img__menu{
		margin-top: 30rpx;
		overflow: hidden;
	}
	.tui-padding{
		width: 100%;
		padding:0 25rpx;
		box-sizing: border-box;
	}
</style>
